﻿using Basic.UserFormService.Calculate.Extend;
using Flee.PublicTypes;

namespace Basic.UserFormService.Calculate
{
    internal static class CalculateLinq
    {
        private static readonly ExpressionContext _Context;
        static CalculateLinq ()
        {
            _Context = new ExpressionContext();
            _Context.Options.RealLiteralDataType = RealLiteralDataType.Decimal;
            _Context.Imports.AddType(typeof(Math));
            _Context.Imports.AddType(typeof(TimeExtend));
            _Context.Imports.AddType(typeof(DictItemExtend));
            _Context.Imports.AddType(typeof(NumberExtend));
            _Context.Imports.AddType(typeof(SpecialExtend));
            _Context.Imports.AddType(typeof(StringExtend));
            _Context.Imports.AddType(typeof(QueryTableExtend));
            _Context.Imports.AddType(typeof(ArrayExtend));
        }

        public static CurState SetCurrentState ( int? rowId )
        {
            return new CurState(rowId);
        }
        public static ExpressionContext Clone ()
        {
            return _Context.Clone();
        }
    }
}
